function [latitude,longitude] = ECI_Position2LatLong(t,R,UTC)

    t = t / 3600 / 24;
    %[solar days]Converts all times from seconds to solar days.

    n = size(R,2);
    %[] Number of data 
    
    latitude = zeros(1,n);
    longitude = zeros(1,n);
    
    Tu = JulianDate(UTC) - 2451545 + t;
    %[solar days]Solar days between the initial universal time and January 1, 2000 at noon.
    
    ERA = 2 * pi * (0.7790572732640 + 1.00273781191135448 * Tu);
    %[rad]Earth rotation angles for all simulation times.
    
    for k = 1:n
       
        EciToEcef = [cos(ERA(k)), sin(ERA(k)), 0; -sin(ERA(k)), cos(ERA(k)), 0; 0, 0, 1];
        %[]Current matrix that transforms vectors from ECI coordinates to ECEF coordinates.
        
        Recef = EciToEcef * R(1:3,k);
        %[km]Current satellite position WRT the Earth in ECEF coordinates.
        
        latitude(k) = asin(Recef(3) / norm(Recef)) * 180 / pi;
        %[deg]Current satellite latitude.
        
        longitude(k) = atan2(Recef(2),Recef(1)) * 180 / pi;
        %[deg]Current satellite longitude.
        
        if isnan(latitude(k))
           
            keyboard
            
        end
           
        
    end

end 